<?php
class Delivery_Model_DbTable_DeletedLogVars
	extends Delivery_Model_DbTable_Abstract

{
	protected $_name = 'log_deleted_vars';
	protected $_primary = array('idLog', 'var');

	public function multiInsert( $vars, $idLog ){
		
		foreach($vars as $var=>$value){
			
			if (empty($value)){
				continue;
			}
			
			if (is_object($value)){
				$value = (array) $value;
			}
			
			if (is_array($value)){

				$n = 1;
				foreach($value as $k=>$v){
					$this->insert(	
						array( 'idlog' => $idLog, 'var' => "$v-$n", 'value'=> $v)
					);
					$n++;
				}
				
				continue;
				
			}
			
			$this->insert(	
				array( 'idlog' => $idLog, 'var' => $var, 'value'=> $value)
			);
		}
	}
	
	

}